package com.wr.springbootRabbitMq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * rabbitmq配置类
 */
@Configuration
public class RabbitMqDirectDeadConfig {

    // 1、声明交换机
    @Bean
    public DirectExchange directExchangeDead(){
        return new DirectExchange("dead-order-exchange");
    }

    //2、声明队列
    @Bean
    public Queue smsDirectDeadQueue(){
        return new Queue("sms.direct.dead.queue");
    }


    //3、绑定交换机与队列
    @Bean
    public Binding smsDirectDeadBinding(){
        return BindingBuilder.bind(smsDirectDeadQueue()).to(directExchangeDead()).with("dead");
    }


}
